unit ArhRepFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, AppUtils, BaseForm, cxGraphics, cxControls, cxLookAndFeels,
  cxLookAndFeelPainters, dxSkinsCore, dxSkinOffice2010Blue, dxSkinscxPCPainter,
  cxPropertiesStore, dxLayoutLookAndFeels, dxLayoutContainer, dxLayoutControl,
  dxSkinOffice2013White, cxStyles, cxCustomData, cxFilter, cxData,
  cxDataStorage, cxEdit, cxNavigator, Data.DB, cxDBData, FIBDataSet,
  pFIBDataSet, cxGridLevel, cxClasses, cxGridCustomView, cxGridCustomTableView,
  cxGridTableView, cxGridDBTableView, cxGrid, cxProgressBar,
  dxLayoutControlAdapters, Vcl.Menus, Vcl.StdCtrls, cxButtons;

type
  TArhRepForm = class(TDezForm)
    grp1: TdxLayoutGroup;
    lc1: TdxLayoutControl;
    lf1: TdxLayoutLookAndFeelList;
    lcf1: TdxLayoutCxLookAndFeel;
    prop1: TcxPropertiesStore;
    v1: TcxGridDBTableView;
    l1: TcxGridLevel;
    grd1: TcxGrid;
    itmlc1Item1: TdxLayoutItem;
    ds_Rep: TpFIBDataSet;
    src_Rep: TDataSource;
    clv1CODE: TcxGridDBColumn;
    clv1NAME: TcxGridDBColumn;
    clv1ARCOBJECT: TcxGridDBColumn;
    clv1NOTE: TcxGridDBColumn;
    clv1ALLCNT: TcxGridDBColumn;
    clv1FREECNT: TcxGridDBColumn;
    clv1PROC: TcxGridDBColumn;
    btn_Refresh: TcxButton;
    itmlc1Item11: TdxLayoutItem;
    btnExcel: TcxButton;
    itmlc1Item12: TdxLayoutItem;
    grplc1Group1: TdxLayoutGroup;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure btn_RefreshClick(Sender: TObject);
    procedure btnExcelClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  ArhRepForm: TArhRepForm;

implementation

uses cmDBUnit;

{$R *.dfm}


procedure TArhRepForm.btnExcelClick(Sender: TObject);
var
  s: TStrings;
begin
  s:= TStringList.Create;
  try
    s.Add(Self.Caption);
    ExportInExcel(grd1,s);
  finally
    FreeAndNil(s);
  end;
end;

procedure TArhRepForm.btn_RefreshClick(Sender: TObject);
begin
  ds_Rep.CloseOpen(false);
end;

procedure TArhRepForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action:= caFree;
end;

procedure TArhRepForm.FormCreate(Sender: TObject);
begin
  LoadForm(prop1,Self.Name);
end;

initialization
 RegisterClass(TArhRepForm);
end.
